<?php
/**
 * Created By Project
 * Author: 陈东
 * Copyright：陈东
 * Source Code：陈东
 * Explain：I shall not authorize for any other commercial purposes, law breakers must be prosecuted.
 */
namespace Home\Controller;
use Think\Controller;

class UserapiController extends Controller {

	//根据用户ID查询红包接口
	public function appidtoport(){
		$appid = I('get.appid',0,'htmlspecialchars');
		$initresult = array('ret'=>0,'msg'=>'不存在的用户');
		if(!$appid && is_numeric($appid)){
			$result = $initresult;
		}else{
			$hbinfo = D(C('TABLE_HBINFO'));
			$res = $hbinfo->where(array('u_appid'=>$appid))->find();
			if($res){
				$res['u_cert'] = C('WEBDOMAIN').$res['u_cert'];
				$res['u_key'] = C('WEBDOMAIN').$res['u_key'];
				$res['confirm'] = md5($_COOKIE['user_userinfo'].'cf@huaren888');
				$result = array('ret'=>1,'data'=>$res);
			}else{
				$result = $initresult;
			}
		}
		echo json_encode($result,JSON_UNESCAPED_SLASHES);
	}

}